UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rwDIcICkMho1m+P6yQ5+8cDz9ANnZUBm4kvyeO9965Y='
WHERE
key_id = 'd61ed3199842a6713e8d333336e6009eff21f620e075ce61601bce162f9d2d34'
AND (
token = 'rwDIcICkMho1m+P6yQ5+8cDz9ANnZUBm4kvyeO9965Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)