UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z9HYqDsNM8SUA58oLY6Xlh8fxzdjQvYW2qVRaw8rJ60=' 
WHERE 
  key_id = '1508486f640c357c41b35b11bc97b457dc0cfa7dbbf59eeacccb7bcbee95a219' 
  AND (
    token = 'z9HYqDsNM8SUA58oLY6Xlh8fxzdjQvYW2qVRaw8rJ60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046