UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iS7nnvUkVNsnYB9NVYoIByzObC2Y3zeXgi99cmXpUe0=' 
WHERE 
  key_id = 'b9dd782a5ae6301ea126152bcb86a6986e042c327b322053c3422f7c5de32b82' 
  AND (
    token = 'iS7nnvUkVNsnYB9NVYoIByzObC2Y3zeXgi99cmXpUe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025