UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'teAuk4i2uowHZ+FWPyZkZvJdXijwjw6kVxhscaG8D7c='
WHERE
key_id = '9212ca1b67d1306d7cb66439c39132b518ccec4637a265ec271fd289d48dcb2e'
AND (
token = 'teAuk4i2uowHZ+FWPyZkZvJdXijwjw6kVxhscaG8D7c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)