UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+JZW1CjQWXxchZjVxEcmrDYCle10tYH5M5P9ZBoM2Ws='
WHERE
key_id = 'b87922cb9e77b59da60cd51f3b0e7142163d268eaba6c6cc1f817e5241fc6cfd'
AND (
token = '+JZW1CjQWXxchZjVxEcmrDYCle10tYH5M5P9ZBoM2Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)