UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tMp7nLsb3XlfqK6Ljlq0UjFAUA0XcUkga2xqjf3B1l8='
WHERE
key_id = 'c42439b2542986eb6e4b499038783cb6004ef2624558e1694fa43b45d676bcce'
AND (
token = 'tMp7nLsb3XlfqK6Ljlq0UjFAUA0XcUkga2xqjf3B1l8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)