UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yX+KrqpuKcS+IzzDcbrBwc+CzccHmJFIKWMaCC6QUds=' 
WHERE 
  key_id = '3079322d897caf8328bbbbf7a446df6f2173cba567b729c54f5a99abc707130d' 
  AND (
    token = 'yX+KrqpuKcS+IzzDcbrBwc+CzccHmJFIKWMaCC6QUds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029