UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0IudeZrlrHc8bW5XNOWphcn3g1+D8HzBA4wUZHTNpE=' 
WHERE 
  key_id = 'e58efca7d5cd58a5540ab5c352d7be22cb78088bf920cf074471985e38cab909' 
  AND (
    token = 'a0IudeZrlrHc8bW5XNOWphcn3g1+D8HzBA4wUZHTNpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032