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