UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yRpCWoJJtuqDfqNEihV6f3U0diAkBCtC2Zm4/ocNW3c='
WHERE
key_id = 'c41b11b46974992e88f3b401f572e594abcb025bf7e21417ed27fbff6eb7406d'
AND (
token = 'yRpCWoJJtuqDfqNEihV6f3U0diAkBCtC2Zm4/ocNW3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)