UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'th1n82PIZm+p3hnbm0BiKyIf260BiS3LW7EIvduUDvA='
WHERE
key_id = '50c74f0f578a812980320aed0eb1e85330775d349e14469804a2cd07cf6c822a'
AND (
token = 'th1n82PIZm+p3hnbm0BiKyIf260BiS3LW7EIvduUDvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)