UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1mM2quaTrKfL+vkHyZLY1V57wi3B3oR6lrzVqiowmU=' 
WHERE 
  key_id = '529174be096d3a50982e663015e957735d147bae1f04833a22777ee3a4c11230' 
  AND (
    token = 'p1mM2quaTrKfL+vkHyZLY1V57wi3B3oR6lrzVqiowmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037