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

Query time 0.00066