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