UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lz+BpZzTV9ilpgIS/JYtEwXYN2XHYvhgUVOnbh2Y3J8='
WHERE
key_id = '1018f7e723dbcca6f54eff0555a7e0ef6e7820a0cb350a96fa5a1f66e9367442'
AND (
token = 'lz+BpZzTV9ilpgIS/JYtEwXYN2XHYvhgUVOnbh2Y3J8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)