UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cI7LqWNeMKWviie9rzxZjH1YS1xuBPLQN29dQj8/Rh8='
WHERE
key_id = 'd99514751342dbefbccf2ca4c7cf523b5c9b9fdfd93a96cb57674a5a951c3b5f'
AND (
token = 'cI7LqWNeMKWviie9rzxZjH1YS1xuBPLQN29dQj8/Rh8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)