UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dA4cmpokoQVECFq0PF0rdBfH9UOAVb/B0SlNciSH1As=' 
WHERE 
  key_id = '3ee400e880a045e6950b4ad8bd297d65912574a6443247941d594a856691d9ce' 
  AND (
    token = 'dA4cmpokoQVECFq0PF0rdBfH9UOAVb/B0SlNciSH1As=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035