UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N/wU5nZM65JoWeYlInJ754mm6hpTo6qHG3Rpm31HEBk='
WHERE
key_id = '8358b11425f01c1de0bb2c0de39790a09b2592c79dcadb3bed6abccc22d19c3d'
AND (
token = 'N/wU5nZM65JoWeYlInJ754mm6hpTo6qHG3Rpm31HEBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)