UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0a8X6uMV3Z83xnFB6zzGvbBqVEp5thyNBmq3FgoXK8s=' 
WHERE 
  key_id = 'dd0b1ed5126a73e78bf3728aaa6a70b41036ab7520695f247904d02770b920a7' 
  AND (
    token = '0a8X6uMV3Z83xnFB6zzGvbBqVEp5thyNBmq3FgoXK8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033