UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qYIVG0CMDmNeg12YgxvE1+i1lmO7TIJWo8qvFXWT/Zw='
WHERE
key_id = 'db3014c582a996b2cde3b92de02d6ccdca360a16ad85b45223f9ab4db7c43ae9'
AND (
token = 'qYIVG0CMDmNeg12YgxvE1+i1lmO7TIJWo8qvFXWT/Zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)