UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TviWXADvQwrGT/eMBMyZFIUbzzQhyczp4wn2uZjOO5Q='
WHERE
key_id = '4bb0145349dd1ee075593dad3a891c4b4e2d4d46ba6ed534051305ce332c4dd8'
AND (
token = 'TviWXADvQwrGT/eMBMyZFIUbzzQhyczp4wn2uZjOO5Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)