UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gRU21THNEEPP2UZs+YNPimgP3DVB29WTd6gsKqm4WIs='
WHERE
key_id = '504c0a26aa4d41afb5b0eb60fccbd717fe4825349936708159b854379c04f5c5'
AND (
token = 'gRU21THNEEPP2UZs+YNPimgP3DVB29WTd6gsKqm4WIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)