UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q2lGMYhcfLuJG5qKLjOot/mhazbC21GCTGYtveziQPU=' 
WHERE 
  key_id = '9873c084f9ab6c843d7ffdfa100c1ba83478ed617fe11fc22f360d841be14a21' 
  AND (
    token = 'Q2lGMYhcfLuJG5qKLjOot/mhazbC21GCTGYtveziQPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027