UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hDHIW78v90WHQBt8SZUK/+WXZgCEVGNtHOdMFgtxwug='
WHERE
key_id = '38b2c541d8549e04b34db70953378ad2a0ad5aacbd589c392874b577a48e5ed3'
AND (
token = 'hDHIW78v90WHQBt8SZUK/+WXZgCEVGNtHOdMFgtxwug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)