UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6JiK6qrFMjoeEkI0uPYkY0gpvkqhQZ8ssDquqaQoIbc=' 
WHERE 
  key_id = '5b2dfe827e235de9573013963559ea58df17c5e2a8e8951c5245b0c70b8eee1e' 
  AND (
    token = '6JiK6qrFMjoeEkI0uPYkY0gpvkqhQZ8ssDquqaQoIbc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038