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

Query time 0.00034