UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r01fFoHTNgYLSkKrORkZYNGE7R96B+sV/gA8iChqmt8=' 
WHERE 
  key_id = 'b1b98a7794e7ff0c660b9ea4705e703f2ab8f32a6237036f6d489f22a968d94f' 
  AND (
    token = 'r01fFoHTNgYLSkKrORkZYNGE7R96B+sV/gA8iChqmt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032