UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u4PKkqlmWp3wHmdC7HCu4ggJVDRocB2hdI2kbsWon6k='
WHERE
key_id = '6e4cf9a3f30f26ce69f983eef497465e5040de05db4bd461a973c60eb753c678'
AND (
token = 'u4PKkqlmWp3wHmdC7HCu4ggJVDRocB2hdI2kbsWon6k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)