UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b7jdvJqIjP+239pxHySVrngW3H105emZmPQfYFgaFj4=' 
WHERE 
  key_id = 'c09da3a691e15a4770d9241f39f1fa96e7506507247974c6e70c31a43f6e1dfc' 
  AND (
    token = 'b7jdvJqIjP+239pxHySVrngW3H105emZmPQfYFgaFj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039