UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a3tGTHPXGlrkU3cNSYJ5UwkpDs4ttPlIrMEVAC7PqZI=' 
WHERE 
  key_id = '3303bdc07f3cd754f6f0fa8405c6694ffc89fd17de901663797f377bd8c11eb3' 
  AND (
    token = 'a3tGTHPXGlrkU3cNSYJ5UwkpDs4ttPlIrMEVAC7PqZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044