UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yxJLE1ad4ieON8FB1GjQx/1dxTrFBLScWNLgheIc5iI='
WHERE
key_id = 'caad316ecba1075c46d2ba809af4bd3b2bc4ef4a8628a2e575fef1a7e3cfdb27'
AND (
token = 'yxJLE1ad4ieON8FB1GjQx/1dxTrFBLScWNLgheIc5iI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)